<template>
  <div class="InvitedConsultation">
    <SubtTitle
      name="受邀列表"
      icon-name="operate"
      has-icon
      style="margin-bottom: 10px"
    ></SubtTitle>

    <Table :tableData="tableData" :columnList="columnList">
        <template v-slot:hzStatus="{ row }">
            <div style="display: flex; justify-content: space-around">
                <span v-if="!row.result" style="color: darkorange;">进行中</span>
                <span v-else style="color: chartreuse;">已完成</span>
            </div>
          </template>
        <template v-slot:caozuo="{ row }">
            <div style="display: flex; justify-content: space-around">
              <el-button :icon="Edit" @click="editor(row)" class="hoveredi">
                进入会议
              </el-button>
            </div>
          </template>
      </Table>
  </div>
</template>

<script setup>
import { ref, reactive, toRefs, onBeforeMount, onMounted } from "vue";
import SubtTitle from "@/components/Title/subtTitle.vue";
import Table from "@/components/Table/table.vue";
import { useRouter, useRoute } from "vue-router";
import {getReceive} from "@/api/index.js"
import usePatientInformation from "@/store/usePatientInformation.js";
const PatientInformation = usePatientInformation();
const router = useRouter();
const route = useRoute();
const header = ref({
  serial: true,
});
const tableData = ref([]);
  const columnList = ref([
    { prop: "hzType", label: "类别", },
    { prop: "patName", label: "患者姓名", },
    { prop: "specialistIdFromName", label: "申请人",  },
    { prop: "sqtime", label: "申请时间",},
    { prop: "specialistIdToName", label: "受邀专家", },
    { prop: "applyMsg", label: "申请理由", },
    { prop: "hzStatus", label: "会诊状态", slot:true},
    { prop: "result", label: "会诊结果", },
    
    { prop: "caozuo", label: "操作", slot:true},
  ]);
  onMounted(()=>{
    getReceive(JSON.parse(localStorage.getItem("user")).id).then(res=>{
      tableData.value = res;
         console.log(res,"2222222");
    })
  })
const editor = (row)=>{
  console.log(row,"23333333333333");
  
  PatientInformation.patientInforList = row
    router.push('/SurgicalMonitoring')

}
</script>
<style scoped lang="scss">
.InvitedConsultation {
  span {
    margin-right: 15px;
  }
  .btn {
    color: #77d3ce;
    cursor: pointer;
  }
}
</style>
